#ifndef __HEADER_H__
#define __HEADER_H__

#ifndef size_t
typedef unsigned long size_t;
#endif
/**
 * ARRAY_SIZE - get the number of elements in array @arr
 * @arr: array to be sized
 */
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

#define offsetof(TYPE, MEMBER)	((size_t)&((TYPE *)0)->MEMBER)

/**
 * sizeof_field(TYPE, MEMBER)
 *
 * @TYPE: The structure containing the field of interest
 * @MEMBER: The field to return the size of
 */
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))

/**
 * offsetofend(TYPE, MEMBER)
 *
 * @TYPE: The type of the structure
 * @MEMBER: The member within the structure to get the end offset of
 */
#define offsetofend(TYPE, MEMBER) \
	(offsetof(TYPE, MEMBER)	+ sizeof_field(TYPE, MEMBER))


#define FIELD(TYPE, MEMBER)   TYPE MEMBER;
struct fields {
#define __START_HEADER_H
#include "_header.h"
};

#define FIELD(TYPE, MEMBER)   field_ ##MEMBER,
enum field_index {
#define __START_HEADER_H
#include "_header.h"
field_max,
};

struct field_desc {
    const char *type;
    size_t sz_type;
    const char *member;
    size_t sz_member;
    size_t offset;
};

#endif
